package com.cloudwise.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

/**
 * @author:高杰领
 * @date:2021/12/24 9:31
 * @description: swagger配置类
 * @version:
 **/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
//    @Value(("${enableSwagger}"))
//    private boolean enableSwagger;
    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
//                .enable(enableSwagger)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.cloudwise.controller"))
                .build()
                ;
    }
    /**
     *
     * @param
     * @return springfox.documentation.service.ApiInfo
     * @author 高冷
     * @description:
     * @date 2021/12/24 9:45
     */
    private ApiInfo apiInfo(){
        Contact concat = new Contact("第一组","http://localhost:8080","1414908592@qq.com");
        return new ApiInfo("Restful的swaggerAPI文档","swaggerAPI文档","1.0","http://localhost:8080",concat,"Apache 2.0","http://ww.apache.org/licenses/LICENSE-2.0",new ArrayList<>());
    }
}
